package com.zmn.oms.third.koubei;

import java.util.Objects;

/**
 * 口碑系列渠道列表
 *
 * @author xiewenbing
 * @date 2021/08/17
 */
public enum KoubeiChannelEnum {

    KOUBEI_CHANNEL_1("平台渠道G2到家", "口碑啄木鸟", 41806, "2088931446668373", "huangyong@zmn.cn"),
    KOUBEI_CHANNEL_2("平台渠道G3到家", "口碑青提", 41807, "2088041982391780", "panting@zmn.cn"),
    KOUBEI_CHANNEL_3("平台渠道G4到家", "口碑家修匠", 41808, "2088041987866245", "jy@zmn.cn"),
    KOUBEI_CHANNEL_4("平台渠道G5到家", "口碑修八方", 41809, "2088041987344594", "gouxiaohua@zmn.cn"),
    KOUBEI_CHANNEL_5("平台渠道G6到家", "口碑快立捷", 41810, "2088041987088504", "liaowenbin@zmn.cn"),
    KOUBEI_CHANNEL_6("平台渠道G8到家", "口碑近邻家修", 41811, "2088041990987230", "tianqiujie@zmn.cn");

    /**
     * 渠道名称
     */
    private String channelName;

    /**
     * 渠道别名
     */
    private String channelAlias;

    /**
     * 渠道id
     */
    private Integer channelId;

    /**
     * 渠道Pid
     */
    private String channelPid;

    /**
     * 渠道账号
     */
    private String channelAccount;

    KoubeiChannelEnum(String channelName, String channelAlias, int channelId, String channelPid, String channelAccount) {

        this.channelName  = channelName;
        this.channelAlias = channelAlias;
        this.channelId = channelId;
        this.channelPid = channelPid;
        this.channelAccount = channelAccount;
    }

    public String getChannelName() {
        return channelName;
    }

    public String getChannelAlias() {
        return channelAlias;
    }

    public String getChannelPid() {
        return channelPid;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public String getChannelAccount() {
        return channelAccount;
    }

    /**
     * 根据渠道PID，获取渠道ID
     * @param channelPid
     * @return
     */
    public static Integer getChannelIdByChannelPid(String channelPid) {

        for (KoubeiChannelEnum channel : KoubeiChannelEnum.values()) {
            if (Objects.equals(channel.getChannelPid(),channelPid)) {
                return channel.getChannelId();
            }
        }

        return KOUBEI_CHANNEL_1.getChannelId();
    }

    /**
     * 是否为口碑渠道
     * @param channelId
     * @return
     */
    public static boolean isKoubeiChannel(Integer channelId) {

        for (KoubeiChannelEnum channel : KoubeiChannelEnum.values()) {
            if (Objects.equals(channel.getChannelId(),channelId)) {
                return true;
            }
        }

        return false;
    }
}
